<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="Author" content="网页作者" />
    <meta name="Copyright" content="网站版权" />
    <meta name="keywords" content="网站关键字" />
    <meta name="description" content="网站描述" />
    <title>AngularJS基于模块胡实现MVC案例</title>
<script type="text/javascript" src="../js/angular.min.js" ></script>
<style type="text/css">
*{margin:0;padding:0}
a{text-decoration:none;color:#111}
ul,li{list-style:none;}
body{font-size:12px;font-family:"微软雅黑";}
</style>
</head>

<body>
<!-- ng-app="myapp" 定义了一个模块
ng-controller的方法名
   -->
  <div ng-app="myapp" ng-controller="myctrl">
     <div>
         <!--   -->
         <input type="text" name="name" ng-model="name" />
     </div>

     <div>
          <!--   -->
         Hello,world{{name}}
     </div>
  </div>



   <script type="text/javascript">
       //初始化Myapp模块
       var myapp = angular.module("myapp",[]);

       //定义模块的控制器   scope要注入方法的一个参数  依赖注入 $scope作用域对象 操作当前作用域视图
       myapp.controller("myctrl",["$scope",function($scope){
        // 对模型进行初始化赋值
            $scope.name = "赋值一个初始值";
       }]);


   </script>

</body>
</html>